<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function fibonacci(n){
            let ori = [0, 1]
            if(n < 2){
                return ori[n]
            }
            let fiboOne = 1,fiboTow = 0, fiboSum = 0
            for(let i = 2; i < n; i++){
                fiboSum = fiboOne + fiboTow
                fiboTow = fiboOne
                fiboOne = fiboSum
            }
            return fiboSum
        }
        console.log(fibonacci(5));
    </script>
</body>
</html>